package com.ssy.lingxi.marketing.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
import java.util.List;

/**
 *  平台活动报名外部状态
 * @author ds
 * @date 2021/6/18
 * @version 2.0.0
 * @see PlatformActivitySignUpOuterStatusEnum
 */
public enum PlatformActivitySignUpOuterStatusEnum {

    ALL(0, "所有状态"),
    // 1为平台外部状态 1: 待提交
    TO_BE_SIGN_UP(2, "待报名"),
    TO_BE_EXAMINE_SIGN_UP(3, "待审核报名"),
    SIGN_UP_PASS(4, "报名审核通过"),
    SIGN_UP_NO_PASS(5, "报名审核不通过"),
    TO_BE_ONLINE(6, "待上线活动"),
    ONGOING(7, "活动进行"),
    END(8, "活动终止"),
    STOP(9, "活动结束"),
    CANCEL(10, "活动取消"),
    ;

    private final Integer code;
    private final String message;

    PlatformActivitySignUpOuterStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code) {
        PlatformActivitySignUpOuterStatusEnum statusEnum = Arrays.stream(PlatformActivitySignUpOuterStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return statusEnum == null ? "" : statusEnum.getMessage();
    }

    /**
     * 报名流程前的外部状态, 待提交, 待报名, 待审核报名
     */
    public static List<Integer> activityPreSignUpList() {
        return Arrays.asList(
                PlatformActivitySignUpOuterStatusEnum.TO_BE_SIGN_UP.getCode(),
                PlatformActivitySignUpOuterStatusEnum.TO_BE_EXAMINE_SIGN_UP.getCode()
        );
    }

    /**
     * 报名流程的外部状态, 待上线活动, 活动进行, 活动终止, 活动结束, 活动取消
     */
    public static List<Integer> activityAftSignUpList() {
        return Arrays.asList(
                PlatformActivitySignUpOuterStatusEnum.TO_BE_ONLINE.getCode(),
                PlatformActivitySignUpOuterStatusEnum.ONGOING.getCode(),
                PlatformActivitySignUpOuterStatusEnum.STOP.getCode(),
                PlatformActivitySignUpOuterStatusEnum.END.getCode(),
                PlatformActivitySignUpOuterStatusEnum.CANCEL.getCode()
        );
    }
}
